package com.purchase.ml.mapper.order;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.purchase.ml.bean.req.report.ReportAdminReq;
import com.purchase.ml.bean.res.dashboard.DashboardConmonRes;
import com.purchase.ml.bean.res.dashboard.DashboardCurMonthOrderRes;
import com.purchase.ml.bean.res.report.ReportAdminRes;
import com.purchase.ml.bean.res.report.vo.ReportDealerSalesDetailVo;
import com.purchase.ml.bean.res.report.vo.ReportDealerSalesVo;
import com.purchase.ml.bean.res.report.vo.ReportRegoinCollectVo;
import com.purchase.ml.bean.vo.order.OrderCollectAmtVo;
import com.purchase.ml.entity.order.SysDealerCollect;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description: 订单
 * @author kyyang
 * @date 2021/2/28 19:55
 * @version 1.0
 */
@Mapper
@Repository
public interface SysDealerCollectMapper extends BaseMapper<SysDealerCollect> {

    List<SysDealerCollect> genOrderCollectByTime(@Param("timeStr") String timeStr);

    List<SysDealerCollect> genOrderCollectByFull(@Param("timeStr") String timeStr);


//    List<SysDealerCollect> cur30DayDateDealer(@Param("timeBegin") String timeBegin,@Param("timeEnd") String timeEnd,@Param("dealerId") Long dealerId);
    List<DashboardCurMonthOrderRes> cur30DayDateDealer(@Param("timeStr") String timeStr,@Param("dealerId") Long dealerId);

//    List<SysDealerCollect> cur30DayDateMaster(@Param("timeBegin") String timeBegin,@Param("timeEnd") String timeEnd,@Param("dealerId") Long dealerId);
    List<DashboardCurMonthOrderRes> cur30DayDateMaster(@Param("timeStr") String timeStr, @Param("dealerId") Long dealerId);

    /**
     * @description: 查询管理员总订单数等
     * @author kyyang
     * @date 2021/3/31 23:55
     * @version 1.0
     */
    ReportAdminRes selectAdminReportToTalPosAndAmtAndProfit(@Param("dealerId")Long dealerId , @Param("startTime") String startTime,@Param("endTime") String endTime,@Param("roleType") int roleType);

    /**
     * @description: 查询管理员总订单数等  天明细
     * @author kyyang
     * @date 2021/3/31 23:55
     * @version 1.0
     */
    List<OrderCollectAmtVo> selectAdminReportProfitDetail(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("roleType") int roleType);

    /**
     * @description: 查询管理员根据地区的 汇总
     * @author kyyang
     * @date 2021/3/31 23:55
     * @version 1.0
     */
    List<ReportRegoinCollectVo> selectAdminReportRegoinCollect(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("roleType") int roleType);

    /**
     * @description: 查询管理员根据地区的 明细
     * @author kyyang
     * @date 2021/3/31 23:55
     * @version 1.0
     */
    List<OrderCollectAmtVo> selectTotalAmtDetailByRegion(@Param("regionName") String regionName,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("roleType") int roleType);

    /**
     * @description: 查询管理员根据 前 10 主经销
     * @author kyyang
     * @date 2021/3/31 23:55
     * @version 1.0
     */
    List<ReportDealerSalesDetailVo> selectAdminReportMasterDealerLimit(@Param("dealerId") Long dealerId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("roleType") int roleType,@Param("index") int index);

    /**
     * @description: 查询管理员根据 前 10 主经销  明细
     * @author kyyang
     * @date 2021/3/31 23:55
     * @version 1.0
     */
    List<OrderCollectAmtVo> selectTotalAmtDetailByDealer(@Param("dealerId") Long dealerId ,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("roleType") int roleType);

    /**
     * @description: 分页查询总数量
     * @author kyyang
     * @date 2021/4/2 14:32
     * @version 1.0
     */
    int selectyMasterDealerSalesPageReportCount(@Param("roleType") int roleType,@Param("dealerId") Long dealerId ,@Param("startTime") String startTime,@Param("endTime") String endTime);

    /**
     * @description: 分页查询记录数
     * @author kyyang
     * @date 2021/4/2 14:35
     * @version 1.0
     */
    List<ReportDealerSalesVo> selectyMasterDealerSalesPageReport(@Param("roleType") int roleType, @Param("dealerId") Long dealerId, @Param("startTime") String startTime, @Param("endTime") String endTime,@Param("start") int start, @Param("end")int end);
}
